package com.njwb.day11.ttt;

public class Student implements Comparable<Student> {
    private String name;
    private int mathScore;
    private int physicsScore;
    private int chineseScore;

    public Student(String name, int mathScore, int physicsScore, int chineseScore) {
        this.name = name;
        this.mathScore = mathScore;
        this.physicsScore = physicsScore;
        this.chineseScore = chineseScore;
    }

    public String getName() {
        return name;
    }

    public int getMathScore() {
        return mathScore;
    }

    public int getPhysicsScore() {
        return physicsScore;
    }

    public int getChineseScore() {
        return chineseScore;
    }

    @Override
    public int compareTo(Student o) {
        if (this.mathScore != o.mathScore) {
            return Integer.compare(o.mathScore, this.mathScore); // 数学降序
        } else if (this.physicsScore != o.physicsScore) {
            return Integer.compare(o.physicsScore, this.physicsScore); // 物理降序
        } else {
            return Integer.compare(o.chineseScore, this.chineseScore); // 语文降序
        }
    }

    @Override
    public String toString() {
        return name + " (数学: " + mathScore + ", 物理: " + physicsScore + ", 语文: " + chineseScore + ")";
    }
}
